<template>
<div class="">
    <p>
        <span class="tit1">养老服务人员男女信用分布</span>
    </p>
    <div ref="chart2" class='top20' style="width: 100%; height: 300px" />
</div>
</template>

<script>
import echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
export default {
    components: {},
    props: {},
    data() {
        return {
            chartData: {
                data1: ['男', '女'],
                data2: ['极好', '良好', '一般','差','极差'],
                data3: [20, 82, 71, 44, 30],
                data4: [40, 52, 81, 21, 10],
            }
        }
    },
    computed: {},
    watch: {

    },
    created() {
        const t = this;

    },
    mounted() {
        const t = this;
        t.initChart();
    },
    methods: {
        initChart() {
            this.chart = echarts.init(this.$refs.chart2, 'macarons')
            this.setOptions()
        },
        setOptions() {
            const t = this;
            this.chart.setOption({
                color: ['#FFAE38','#4E7FE6'],
                tooltip: {
                    trigger: 'axis',
                    axisPointer: {
                        label: {
                            backgroundColor: '#6a7985'
                        }
                    }
                },
                grid: {
                    top: '5%',
                    left: '3%',
                    right: '8%',
                    bottom: '3%',
                    containLabel: true
                },
                xAxis: [{
                    type: 'category',
                    boundaryGap: false,
                    data: t.chartData.data2
                }],
                yAxis: [{
                    type: 'value',
                    axisLabel: {
                        formatter: '{value}%'
                    }
                }],
                series: [{
                        name: t.chartData.data1[0],
                        type: 'line',
                        data: t.chartData.data3
                    },
                    {
                        name: t.chartData.data1[1],
                        type: 'line',
                        data: t.chartData.data4
                    }
                ]
            })
        }
    }
}
</script>

<style lang="scss" scoped>
</style>
